
from Base import Base
from selenium.webdriver.common.by import By
import time

class Page(Base):
    #搜索框输入内容
    search_loc = (By.ID,'kw')
    #点击搜索按钮
    searchbtn_loc = (By.ID,'su')
    #悬停
    xuan = (By.XPATH,'/html/body/div[3]/div[1]/div[2]/a[2]')
    #点击高级设置
    advanced = (By.LINK_TEXT,'高级搜索')

    q1 = (By.XPATH,'//*[@id="adv_keyword"]')

    def search(self):
        # self.find_element(self.search_loc).send_keys('UI自动化')
        self.send_keys(self.search_loc,'UI自动化')

    def searchbtn(self):
        self.click(self.searchbtn_loc)

    def xuanting(self):
        self.move_to_element(self.xuan)

    def adced(self):
        self.click(self.advanced)

    def all(self):
        self.allin(self.search_loc)

    def fuzhi(self):
        self.ctrlc(self.search_loc)

    def zhantie(self):
        self.ctrlv(self.q1)

    def lioji_baidu(self):
        self.open_url('https://www.baidu.com/')
        self.search()
        time.sleep(3)
        self.searchbtn()
        time.sleep(2)
        self.all()
        time.sleep(2)
        self.fuzhi()
        time.sleep(2)
        self.xuanting()
        time.sleep(2)
        self.adced()
        time.sleep(2)
        self.zhantie()
        time.sleep(2)